package textviewer.main;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public class InternetBookClickListener implements OnClickListener{
	private Context parent;
	private String target_url;
	private String target_book;
	private String book_id;
	private int sitelistening_on =0;
	private String new_cookie;
	public InternetBookClickListener(Context parent,String target_book, String target_url,String book_id)
	{
		this.parent=parent;
		this.target_url=target_url;
		this.target_book=target_book;
		this.book_id=book_id;
		sitelistening_on=0;
	}
	private String forum_name;
	private String forum_url;
	public InternetBookClickListener(String new_cookie,Context parent, String forum_name, String forum_url )
	{
		this.parent=parent;
		this.forum_name=forum_name;
		this.forum_url=forum_url;
		sitelistening_on=1;
		this.new_cookie=new_cookie;
	}
	public void onClick(View arg0) {
		if(sitelistening_on==0)
		{
			Intent int_ent = new Intent(parent, GUIInternetChapterSelection.class);
			int_ent.putExtra("target_book", target_book);
			int_ent.putExtra("target_url", target_url);
			int_ent.putExtra("book_id", book_id);
			int_ent.putExtra("listenOnID", sitelistening_on);
			parent.startActivity(int_ent);
		}
		else if(sitelistening_on==1)
		{
			//listen_onID2Forum
			Intent int_ent = new Intent(parent, GUIInternetForumChSelection.class);
			int_ent.putExtra("forum_name", forum_name);
			int_ent.putExtra("forum_url", forum_url);
			int_ent.putExtra("listenOnID", sitelistening_on);
			int_ent.putExtra("new_cookie", new_cookie);
			//listenOnID
			parent.startActivity(int_ent);

		}
	}

}
